home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / mail-tools / thor / thor_2.22 / thor.lha / rexx / BBSRead / CheckUserDatabase.br < prev    next >
Text File  |  1995-12-17  |  2KB  |  90 lines

  1. /* CheckUserDataBase.br
  2.  *
  3.  * Script by: Eivind Nordseth, Ultima Thule Software.
  4.  */
  5.  
  6. /*    trace results */
  7.  
  8.     parse arg argument
  9.  
  10.     template = 'BBSNAME/A,DELETE/S'
  11.  
  12.     if (argument = '' | argument = '?') then 
  13.     do
  14.         say '$VER: CheckUserDataBase 4.2 (16.12.95)'
  15.         say 'Checks the the users in one or ALL BBSes. If the DELETE switch is used will '
  16.         say 'all users which are impossible to read be marked as deleted.'
  17.         say 'Template:' template
  18.         exit
  19.     end
  20.  
  21.     if ~show('p', 'BBSREAD') then do
  22.         address command
  23.             "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  24.             "WaitForPort BBSREAD"
  25.     end
  26.  
  27.     address BBSREAD
  28.  
  29.     READARGS template ARGS CMDLINE argument
  30.     if(rc ~= 0) then 
  31.     do
  32.         say BBSREAD.LASTERROR
  33.         exit
  34.     end
  35.  
  36.     options failat 31
  37.  
  38.     if upper(ARGS.BBSNAME) = "ALL" then
  39.     do
  40.         GETBBSLIST stem BBSLIST 
  41.         if(rc ~= 0) then 
  42.         do
  43.             say BBSREAD.LASTERROR
  44.             exit
  45.         end
  46.  
  47.         do n=1 to BBSLIST.COUNT
  48.             call CheckBBS('"'||BBSLIST.n||'"')
  49.         end
  50.     end
  51.     else call CheckBBS('"'||ARGS.BBSNAME||'"')
  52.  
  53.     exit
  54.  
  55.  
  56. CheckBBS:
  57. parse arg nameofbbs
  58.  
  59.     say 'Checking:' strip(nameofbbs,'B','"')
  60.  
  61.     GETBBSDATA nameofbbs BBSDATA
  62.     if(rc ~= 0) then 
  63.     do
  64.         say BBSREAD.LASTERROR
  65.         exit
  66.     end
  67.  
  68.     do k=BBSDATA.FIRSTUSER to BBSDATA.LASTUSER
  69.     
  70.         READBRUSER nameofbbs k tagsstem TAGS datastem DATA
  71.  
  72.         if(rc ~= 0) then 
  73.         do
  74.             Say ' Error reading user' k ':' BBSREAD.LASTERROR
  75.  
  76.             if ARGS.DELETE ~= 0 then 
  77.             do
  78.                 say '  Marking user as deleted.'
  79.  
  80.                 WRITEBRUSER nameofbbs UPDATEUSERNR k DELETEUSER
  81.                 if(rc ~= 0) then 
  82.                 do
  83.                     say '  Unable to mark user as deleted:' BBSREAD.LASTERROR
  84.                 end
  85.             end
  86.         end
  87.     end
  88.  
  89.     return
  90.